<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/WEB-INF/template/template.xhtml">

    <ui:define name="Content">

        <ui:param name="bean" value="#{userMBean}" />

        <h:panelGrid rendered="${param.state=='failure'}">
            <div class="ERROR">
                Your login attempt was not successful, try again.<br />
                Reason: #{sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message}
            </div>
        </h:panelGrid>

        <p:fieldset legend="Login">
            <form action="#{request.contextPath}/j_spring_security_check" method="post">

                <h:panelGrid columns="2">
                    <h:outputText value="User:" />
                    <h:inputText id="j_username" value="#{username}" styleClass="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all"/>

                    <h:outputText value="Password:" />
                    <h:inputSecret id="j_password" styleClass="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all"/>

                    <f:facet name="footer"> 
                        <h:commandButton  value="Login" type="submit"  />
                    </f:facet>
                </h:panelGrid>

            </form>
        </p:fieldset>

    </ui:define>
</ui:composition>
